<?php
class ImpSoft_View_Helper_FormatZip {

    public function formatZip($zip) {
    
        $zip = preg_replace('#[^0-9]#', '', $zip);
        $length = strlen($zip);
        if ($length == 5) {
            return $zip;
        }
        if ($length == 9) {
            $a = substr($zip, 0, 5);
            $b = substr($zip, 5, 4);
            return "$a-$b";
        }
        return false;
    
    }

}